package com.itlong.cloud.app.resource;

import com.itlong.cloud.app.service.IAppOldDeviceRecordService;
import com.itlong.cloud.enumerate.oldapp.Message;
import com.itlong.cloud.equip.app.IAppOldDeviceRecordServiceClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * <desc>
 *     旧版APP_用户通行记录代理实现类
 * </desc>
 *  @createDate 2017/11/10
 */
@RestController
public class AppOldDeviceRecordResource implements IAppOldDeviceRecordServiceClient{

    @Autowired
    IAppOldDeviceRecordService iAppOldDeviceRecordService;

    /**
     * <desc>
     *     旧版APP_查询通行记录
     * </desc>
     * @param userId 当前用户用户ID
     * @param pageNo
     * @param pageSize
     * @param projectId 当前项目编号
     * @return
     * @throws Exception
     * @author cuiduanwu
     * @createDate 2017/11/8
     */
    @Override
    @RequestMapping(path = "/app/deviceRecord/list",method = RequestMethod.POST)
    public Message getDeviceRecord(@RequestParam("userId") String userId,
            @RequestParam("pageNo") Integer pageNo,@RequestParam("pageSize") Integer pageSize,
            @RequestParam("projectId") String projectId) throws Exception{
        return iAppOldDeviceRecordService.getDeviceRecord(userId,pageNo,pageSize,projectId);
    }
    /**
     * <desc>
     *     旧版APP_上传通行记录
     * </desc>
     * @param userId
     * @param recordJson
     * @return
     * @throws Exception
     * @author cuiduanwu
     * @createDate 2017/11/9
     */
    @Override
    @RequestMapping(path = "/app/deviceRecord/upload",method = RequestMethod.POST)
    public Message deviceRecordUpload(@RequestParam("userId") String userId,@RequestParam("recordJson") String recordJson) throws Exception{
        return iAppOldDeviceRecordService.deviceRecordUpload(userId,recordJson);
    }


}
